package com.hdax.dm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.dm.common.utils.CommonResponse;
import com.hdax.dm.common.utils.ResponseUtil;
import com.hdax.dm.dtos.scheduler.PriceDto;
import com.hdax.dm.entity.scheduler.DmSchedulerSeatPrice;
import com.hdax.dm.mappers.SchedulerSeatPriceMapper;
import com.hdax.dm.mapstructs.PriceDtoMapper;
import com.hdax.dm.service.SchedulerSeatPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SchedulerSeatPriceServiceImpl extends ServiceImpl<SchedulerSeatPriceMapper, DmSchedulerSeatPrice> implements SchedulerSeatPriceService {

    @Autowired
    private PriceDtoMapper priceDtoMapper;

    @Override
    public CommonResponse<List<PriceDto>> prices(Long scheduleId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("scheduleId",scheduleId);
        return ResponseUtil.returnSuccess(priceDtoMapper.toTargetList(list(queryWrapper)));
    }

    @Override
    public Long seatPrice(Long scheduleId, Long areaLevel) {
        return baseMapper.seatPrice(scheduleId, areaLevel);
    }
}
